package com.avira.smstest;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends Activity
{
	
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		Bundle extras = getIntent().getExtras();
		
		if (extras != null)
		{
			SMSObject smsObject = (SMSObject) extras.getParcelable(SMSObject.class.getCanonicalName() );
			
			if (smsObject != null)
			{
			    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
			    dialogBuilder.setTitle(smsObject.getSender() );
			    dialogBuilder.setMessage(smsObject.getContents() );
			    dialogBuilder.setCancelable(true);
			    dialogBuilder.setNeutralButton(android.R.string.ok,
			            new DialogInterface.OnClickListener()
					    {
					        public void onClick(DialogInterface dialog, int id)
					        {
					            dialog.cancel();
					        }
					    }
			    );

			    AlertDialog alertDialog = dialogBuilder.create();
			    alertDialog.show();
			}
		}
	}

}
